package com.ssyt.ssh.common;

import java.util.Map;

import org.apache.struts2.interceptor.ApplicationAware;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;
import com.ssyt.ssh.entity.Employee;

public abstract class BaseAction extends ActionSupport implements RequestAware, SessionAware, ApplicationAware {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Map<String, Object> application;
	private Map<String, Object> session;
	private Map<String, Object> request;
	private String errorUrl; // 错误信息显示URL
	
	public String getErrorUrl() {
		return errorUrl;
	}

	public void setErrorUrl(String errorUrl) {
		this.errorUrl = errorUrl;
	}

	@Override
	public void setApplication(Map<String, Object> application) {
		this.application = application;
		
	}

	@Override
	public void setSession(Map<String, Object> session) {
		this.session = session;
		
	}

	@Override
	public void setRequest(Map<String, Object> request) {
		this.request = request;
		
	}

	public Map<String, Object> getApplication() {
		return application;
	}

	public Map<String, Object> getSession() {
		return session;
	}

	public Map<String, Object> getRequest() {
		return request;
	}
	
	/**
	 * 获取当前操作的员工
	 * @return
	 */
	protected Employee getCurrentUser() {
		return (Employee) session.get("username");
	}
	
}
